import QtQuick
import QtQuick.Controls.Material
import QtQuick.Layouts

Item {
    id: passwordSettingWindowRoot
    width: rootWidth
    height: rootHeight /*- 150*/

    Component.onDestruction: {
        // Cpp_PLC.QML_CurrentPage = 5;
        // Cpp_PLC.write_Modbus_RTU_Hold_16(48,"3")
        // write_Current_Page_Parameter_Into_PLC(0)
        console.log("加密页面关闭")
    }

    property string testString: "12345678,12345678"

    A_Label{
        anchors.top: parent.top
        anchors.topMargin: 100
        anchors.horizontalCenter: parent.horizontalCenter
        labelWidth: 400
        label_pointSize: 60
        label_Data: qsTr("锁 定 日 期")

        MouseArea{
            anchors.fill: parent

            pressAndHoldInterval : 300
            onPressAndHold: {
                Cpp_PLC.read_CustomNumber_And_OrderNumber()
            }

        }

    }

    RowLayout{
        anchors.top: parent.top
        anchors.topMargin: 200
        anchors.horizontalCenter: parent.horizontalCenter
        // anchors.left: parent.left
        // anchors.leftMargin: 300
        A_Label{

            labelBorderColor: "white"
            labelBack: "black"
            label_FontColor: "aqua"
            label_pointSize: 30
            label_Data: Cpp_Config.lock_Year

        }
        A_Label{
            labelWidth: 80
            labelHeight: 80
            label_pointSize: 50
            label_Data: qsTr("年")
        }
        A_Label{
            labelWidth: 100
            labelBorderColor: "white"
            labelBack: "black"
            label_FontColor: "aqua"
            label_pointSize: 30
            label_Data: Cpp_Config.lock_Month

        }
        A_Label{

            labelWidth: 80
            labelHeight: 80
            label_pointSize: 50
            label_Data: qsTr("月")
        }
        A_Label{
            labelWidth: 100
            labelBorderColor: "white"
            labelBack: "black"
            label_FontColor: "aqua"
            label_pointSize: 30
            label_Data: Cpp_Config.lock_Day

        }
        A_Label{
            labelWidth: 80
            labelHeight: 80
            label_pointSize: 50
            label_Data: qsTr("日")
        }
    }


    RowLayout{
        anchors.top: parent.top
        anchors.topMargin: 300
        anchors.horizontalCenter: parent.horizontalCenter


        A_Label{
            labelWidth: 100
            labelBorderColor: "white"
            labelBack: "black"
            label_FontColor: "aqua"
            label_pointSize: 30
            label_Data: Cpp_Config.lock_Hour

        }
        A_Label{

            labelWidth: 80
            labelHeight: 80
            label_pointSize: 50
            label_Data: qsTr("时")
        }
        A_Label{
            labelWidth: 100
            labelBorderColor: "white"
            labelBack: "black"
            label_FontColor: "aqua"
            label_pointSize: 30
            label_Data: Cpp_Config.lock_Minute

        }
        A_Label{
            labelWidth: 80
            labelHeight: 80
            label_pointSize: 50
            label_Data: qsTr("分")
        }

    }

    Rectangle{
        anchors.top: parent.top
        anchors.topMargin: 450
        anchors.horizontalCenter: parent.horizontalCenter
        width: 450
        height: 450
        // border.width: 1
        color: "transparent"

        A_Label{
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.top: parent.top
            anchors.topMargin: 10
            labelWidth: 250
            labelHeight: 80
            label_pointSize: 50
            label_Data: qsTr("序列号")
        }

        A_Label{
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.top: parent.top
            anchors.topMargin: 100
            labelWidth: 250
            labelHeight: 80
            labelBorderColor: "white"
            labelBack: "black"
            label_FontColor: "aqua"
            label_pointSize: 50
            label_Data: Cpp_PLC.PLC_Order_Number
        }

        A_Label{
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.top: parent.top
            anchors.topMargin: 200
            labelWidth: 250
            labelHeight: 80
            label_pointSize: 50
            label_Data: qsTr("厂家码")
        }


        A_Label{
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.top: parent.top
            anchors.topMargin: 290
            labelWidth: 250
            labelHeight: 80
            labelBorderColor: "white"
            labelBack: "black"
            label_FontColor: "aqua"
            label_pointSize: 50
            label_Data: Cpp_PLC.PLC_Customer_Number
        }

        // MouseArea{
        //     anchors.fill: parent
        //     pressAndHoldInterval: 300

        //     onPressAndHold: {

        //     }

        // }


    }





    RowLayout{
        anchors.top: parent.top
        anchors.topMargin: 1000
        anchors.horizontalCenter: parent.horizontalCenter
        spacing: 20

        A_Label{
            labelWidth: 100
            label_pointSize: 30
            label_Data: qsTr("密 码")
        }

        // A_TextInput{
        //     id: passwdInput
        //     inputWidth: 600
        //     maxDataLength: 20
        //     validatorFlag: false
        //     showData: inputData
        // }

        Rectangle{
            width: 600
            height: 70
            radius: 10
            border.width: 1
            // color: "gold"

            TextInput{
                id: passwdInput
                anchors.centerIn: parent
                font.pixelSize: 40
                maximumLength: 20

                onEditingFinished: {
                    focus = false
                    Cpp_PLC.Input_Passwd = text
                }
            }

            MouseArea{
                anchors.fill: parent

                onClicked: {
                    passwdInput.forceActiveFocus()
                    passwdInput.selectAll()
                }

                onPressAndHold: {
                    // console.log(11111111111)
                    passwdInput.paste()
                    Cpp_PLC.Input_Passwd = passwdInput.text
                }
            }

        }

        A_Button{
            contentText_Data: qsTr("确 认")
            contentText_Fontsize: 40

            onButtonClicked: {
                parent.forceActiveFocus()
                Cpp_PLC.read_CustomNumber_And_OrderNumber()
            }
        }
    }





}
